﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;

namespace ControlExplorer
{
    public partial class Template_Fill : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                string url = "";

                // 模板编号
                string tid = null;
                tid = Request.QueryString["tid"];

                // 历史编号
                string hid = null;
                hid = Request.QueryString["hid"];

                DataRow dr = DataTools.GetTemplate(tid);

                string templatetype = dr["模板类型"].ToString();

                if (templatetype.Equals("固定行模板"))
                {
                    url = "~/FixedForm.aspx?tid=" + tid;
                    if (!string.IsNullOrWhiteSpace(hid))
                    {
                        url = (url + "&hid=" + hid);
                    }
                    Response.Redirect(url);
                }
                else if (templatetype.Equals("动态行模板"))
                {
                    url = "~/DynamicRows.aspx?tid=" + tid;
                    if (!string.IsNullOrWhiteSpace(hid))
                    {
                        url = (url + "&hid=" + hid);
                    }
                    Response.Redirect(url);
                }
            }
        }
    }
}